#ifndef __MPP_SCREENS_H__
#define __MPP_SCREENS_H__

#include "mpp_display_element.h"
#include "mpp_display_buffer.h"
#include "mpp_display_planes.h"



#include "mpp_display_buffer.h"
using namespace  std;


class mpp_screens: protected  mpp_display_planes
{
    public :
        mpp_screens(uint32_t width, uint32_t height,uint32_t vrefresh,uint32_t format);    
        ~mpp_screens();

    private:
        void mpp_drow_background(mpp_display_buffer *buffer);
        drmModeModeInfoPtr mpp_find_modeInfo(drmModeConnectorPtr connector,
                                                                        uint32_t width, uint32_t height,uint32_t vrefresh);
        drmModeEncoderPtr   mpp_find_encoder(drmModeConnectorPtr connector);
        drmModeCrtcPtr   mpp_find_crtc(drmModeEncoderPtr encoder);

    protected:

        bool mpp_start_display();
        void *mpp_get_addr();
        bool mpp_is_startDisplay();     

        int mpp_setPlane(uint32_t fb_id, uint32_t flags,
			   int32_t crtc_x, int32_t crtc_y,
			   uint32_t crtc_w, uint32_t crtc_h,
			   uint32_t src_x, uint32_t src_y,
			   uint32_t src_w, uint32_t src_h );

        class current_screens    // --记录当前使用的屏幕参数
        {
            public:
                drmModeConnectorPtr connector;
                drmModeModeInfoPtr modeInfo;
                drmModeEncoderPtr encoder ;
                drmModeCrtcPtr        crtc     ;
                 drmModePlanePtr      plane ;
                mpp_display_buffer    *buffer;
                current_screens():connector(NULL),modeInfo(NULL),encoder(NULL),crtc(),buffer(NULL),plane(NULL)
                {

                }
        };
        current_screens *m_current_screens;
        uint32_t width,  height,vrefresh, format ;

    private:    
        // FILE *br_file;                       
        //size_t  src_length ;                          
        //uint8_t *src;

        friend class mpp_showing;     //--定义友元类
        
};




#endif